import { HOME_URL, LOGIN_URL } from "@/config";
/*
 * staticRouter (静态路由)
 */
export const staticRouter = [
  {
    path: LOGIN_URL,
    name: "login",
    component: () => import("@/views/login.vue"),
    meta: {
      title: "登录",
    },
  },
  {
    path: "/",
    redirect: HOME_URL,
    component: () => import("@/layouts/index.vue"),
    children: [
      {
        path: HOME_URL,
        meta: {
          title: "欢迎页",
        },
        component: () => import("@/views/welcome.vue"),
      },
    ],
  },
];

/**
 * errorRouter (错误页面路由)
 */
export const errorRouter = [
  {
    path: "/403",
    name: "403",
    component: () => import("@/components/ErrorMessage/403.vue"),
    meta: {
      title: "403页面",
    },
  },
  {
    path: "/404",
    name: "404",
    component: () => import("@/components/ErrorMessage/404.vue"),
    meta: {
      title: "404页面",
    },
  },
  {
    path: "/500",
    name: "500",
    component: () => import("@/components/ErrorMessage/500.vue"),
    meta: {
      title: "500页面",
    },
  },
  // Resolve refresh page, route warnings
  {
    path: "/:pathMatch(.*)*",
    component: () => import("@/components/ErrorMessage/404.vue"),
  },
];

/*
 * menuRouter（功能页面路由）
 */
export const menuRouter = [
  {
    path: "/",
    name: "layout",
    component: () => import("@/layouts/index.vue"),
    children: [
      {
        path: "index",
        meta: {
          title: "首页",
          sort: 2,
        },
        component: () => import("@/views/homepage/index.vue"),
      },
      {
        path: "template",
        meta: {
          title: "模板页",
          sort: 99,
        },
        component: () => import("@/views/template/index.vue"),
        children: [
          {
            path: "demo1",
            meta: {
              title: "模板页1",
              sort: 3,
            },
            component: () => import("@/views/template/demo1/index.vue"),
          },
          {
            path: "demo2",
            meta: {
              title: "模板页2",
              sort: 2,
            },
            component: () => import("@/views/template/demo2/index.vue"),
          },
        ],
      },
    ],
  },
  {
    path: "/dataScreen",
    component: () => import("@/views/dataScreen/index.vue"),
    meta: {
      sort: 1,
      title: "数据大屏",
    },
  },
];
